package com.huage_06.lesson_01;

public class ExceptionDemo {
    public static void main(String[] args) {

       try {
           System.out.println("开始");
           method();
           System.out.println("结束");
       }catch (ArrayIndexOutOfBoundsException e){
           //e.printStackTrace();
          // System.out.println(e.getMessage());
           System.out.println(e.toString());
       }


    }
    public static void method(){
        int[] arr = {1,2,3};
        System.out.println(arr[0]);
        System.out.println(arr[1]);
        System.out.println(arr[2]);
        System.out.println(arr[3]);
    }
}
